package com.easy.controller;

import com.easy.bean.Bed;
import com.easy.bean.Cases;
import com.easy.common.CommonResult;
import com.easy.dao.ICasesDao;
import com.easy.service.IBedService;
import com.easy.service.ICasesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Transactional
public class HospitalController {

    @Autowired
    ICasesService caseS;
    @Autowired
    IBedService bedS;

    @PostMapping("addcases")
    public CommonResult insertJSON(@RequestBody Cases cases){
        System.out.println(cases);
        caseS.addCases(cases);
        cases=caseS.getCasesById(cases.getId());
        return CommonResult.success(cases);
    }
    @PutMapping("editcasespay")
    public CommonResult editCasesPay(@RequestBody Cases cases){
        caseS.editCasesPay(cases);
        cases=caseS.getCasesById(cases.getId());
        return CommonResult.success(cases);


    }
}
